import heapq
import cplex
import node

class tree:
    def __init__(self, root):
        self.global_up_bnd = 0
        self.global_z = 0
        
        # store the nodes in a priority queue
        self.nodeq = []
        heapq.heappush(self.nodeq, root)

    def pop(self):
        # pop the node with least priority
        node = heapq.heappop(self.nodeq)
        return node
    
    def branch(self, parent):
        #generate two child node and then push them into the tree 
        parent.set_branch_var()
        child1 = node.node(parent, "UP")
        child2 = node.node(parent, "DOWN")
        heapq.heappush(self.nodeq, child1)
        heapq.heappush(self.nodeq, child2)
        # or node.remove(bbtree)
        
        
    #def update_bound(self, node):
        #compare node.z and tree.global_z

    #def update_incumbent(self, ):
            
